<template>
  <div id="detail">
    <div class="total_grade">
      <h1 class="total_grade_title">总战绩</h1>
      <div class="total_grade_conten">
        <div class="total_chart">
          <div class="chart_pie" ref="pie">
          </div>
        </div>
      </div>
    </div>
    <div class="grade">
      <h1>麻将战绩</h1>
      <ul class="table">
        <li>对局数</li>
        <li>胜</li>
        <li>平</li>
        <li>负</li>
        <li>胜率</li>
        <li>最大得分</li>
      </ul>
      <ul class="table table_grade">
        <li v-for="item in mahjongData" :key="item">{{item}}</li>
      </ul>
    </div>
  </div>
</template>


<script>
// import Line from "echarts/lib/chart/line";
import echarts from "echarts";
import utils from "../../scripts/utils";
export default {
  data() {
    return {
      pieData: [
        {
          value: 48,
          name: "保定麻将"
        },
        {
          value: 22,
          name: "邢台麻将"
        },
        {
          value: 30,
          name: "唐山麻将"
        }
      ],
      mahjongData: [31213, 312313, 3123131, 312313, "59%", 888],
      pokerData: [31213, 312313, 3123131, 312313, "59%", 888]
    };
  },
  created() {
    let url =
      "native://?action=" + "settitle&title=" + encodeURIComponent("战绩详情");
    utils.native_call(url);
  },
  mounted() {
    this.drawPieChart();
  },
  methods: {
    drawPieChart() {
      var myChart = echarts.init(this.$refs.pie);
      // 绘制图表
      myChart.setOption({
        legend: {
          orient: "vertical",
          left: "6%",
          top: "25%",
          textStyle: {
            fontWeight: "normal", //标题颜色
            color: "#FFFFFF"
          },
          data: ["保定麻将", "唐山麻将", "邢台麻将"]
        },
        series: [
          {
            center: ["75%", "50%"],
            name: "总战绩",
            avoidLabelOverlap: false,
            type: "pie",
            data: this.pieData,
            label: {
              normal: {
                show: false,
                position: "center"
              },
              emphasis: {
                show: true,
                textStyle: {
                  fontSize: "30",
                  fontWeight: "bold"
                }
              }
            }
          }
        ]
      });
    }
  }
};
</script>



<style scoped>
#detail {
  color: #fff;
  padding: 0.3rem 0.14rem 0;
  text-align: center;
}

.total_grade,
.grade {
  background: url("../images/title_bg.png") center top no-repeat;
  background-color: #001523;
  background-size: 2.27rem 0.4rem;
  border-radius: 0.1rem;
  box-shadow: 0 0 0.2rem #1c5d86;
}

.total_grade_title {
  font-size: 0.3rem;
}

.total_chart {
  position: relative;
}

.chart_pie {
  height: 3rem;
  width: 100%;
}

.table {
  display: flex;
}

.table li {
  border: 2px solid #062d49;
  border-right-width: 0;
  flex-basis: 0;
  flex-grow: 1;
  padding: 0.2rem 0;
}
.table li:first-child {
  border-left-width: 0;
}
.table_grade li {
  border-top-width: 0;
}

.grade {
  margin-top: 0.22rem;
  position: relative;
}

.grade h1 {
  font-size: 0.3rem;
  height: 0.4rem;
  line-height: 0.4rem;
}

.detail {
  background: url("../images/more_bg.png") no-repeat;
  background-size: cover;
  height: 0.4rem;
  position: absolute;
  right: 0;
  top: 0;
  width: 0.84rem;
}

.line {
  height: 4.2rem;
  width: 100%;
}
</style>
